// 引入mongoose
const mongoose = require("mongoose")

//创建管理员列表的约束对象
const adminSchema = new mongoose.Schema({
    adminName: {
        type: String,
        unique: true,
        required: true
    },
    password: {
        type: String,
        required: true
    },
    regTime: {
        type: String,//如果直接使用Date对象,不方便世间的查看
        required: true
    },
    loginTime: {
        type: String,
        required: true,
        default: "----"//设置默认值,有则用新值,无则同默认
    },  
    status: {
        type: Number,
        require: true,
        default: 0
    }
})

//根据某个约束对象创建集合,参数1是集合名称,参数2是填入的数据
const adminModel = mongoose.model("adminList",adminSchema)

//暴露集合
module.exports = adminModel